﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZF.BLL;
using ZF.WS.UserControls;
using GCELibrary.Current;

namespace ZF.WS.house
{
    public partial class HouseReq : BLL.Page.PageBase, IHouseEditPage
    {
        /// <summary>
        /// 当前页面的操作行为
        /// </summary>
        [PageArgument(Key = "ot", DefaultValue = PageOperType.AddNew)]
        public override PageOperType OperType { get; set; }

        [PageArgument(Key = "hid", CanNull = false, BindOperType = PageOperType.Edit)]
        public int HouseId { get; set; }

        [PageArgument(Key = "dt", DefaultValue = 1, BindOperType = PageOperType.AddNew)]
        public int DealType { get; set; }

        public string Type { get; set; }

        public virtual QuiHouseEdit HouseEdit { get { return this.QuiHouseEdit1; } }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (!IsPostBack)
            {
                if (this.OperType == PageOperType.AddNew)
                {
                    if (!(this.DealType == 1  || this.DealType == 2))
                    {
                        throw WarnFactory.CreateWarn(WarnCode.ParameterError);
                    }
                    HouseEdit.Add();

                }
                else if (this.OperType == PageOperType.Edit)
                    HouseEdit.Edit();
            }
        }
    }
}
